#include<iostream>
#include<cmath>
using namespace std;
typedef long long LL;
const int N = 1e5 + 10;
int n;
int main()
{
	cin >> n;
	bool flag = 0;
	for (int i = 1; i <= 31; i++) {
		LL x = pow(2, i);
		if (x == (LL)n) {
			flag = 1;
			break;
		}
	}
	if (flag) {
		cout << "1" << endl;
	}
	else {
		int cnt = 1;
		while (n != 2) {
			if (n & 1) {
				cnt++;
				n -= 1;
			}
			n /= 2;
		}
		cout << cnt << endl;
	}
	return 0;
}